include java.lang.Math;

public static boolean isPrime(int n)
{
  
  if (n < 1) return false;
  if (n == 1) return true;
  
  if (n % 2 == 0) return false;
  
  // For odd numbers up till root of p
 for (int i = 3; i <= Math.sqrt(n); i += 2)
 {
   if (n % i == 0 ) return false;
 }
  
  return true;
}

